package com.practice.sequence;

public class StockPrice {
	public int maxProfit(int[] price) {
		int low = price[0];
		int profit = 0;
		
		for (int p : price) {
			if (p < low) {
				low = p;
			}
			else if (p-low > profit) {
				profit = p - low;
			}
		}
		
		return profit;
	}
}
